        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>PolygonAndCircleContact class / box2d_console Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d_console" data-type="PolygonAndCircleContact">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d_console.html">box2d_console</a> &rsaquo; <a href="../box2d_console/PolygonAndCircleContact.html">PolygonAndCircleContact</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>PolygonAndCircleContact</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<pre class="source">
class PolygonAndCircleContact extends Contact {

  PolygonAndCircleContact(DefaultWorldPool argPool) :
    super(argPool) { }

  void init(Fixture fA, Fixture fB) {
    Expect.equals(ShapeType.POLYGON, fA.type);
    Expect.equals(ShapeType.CIRCLE, fB.type);
    super.init(fA, fB);
  }

  void evaluate(Manifold argManifold, Transform xfA, Transform xfB) {
    pool.collision.collidePolygonAndCircle(argManifold, fixtureA.shape,
        xfA, fixtureB.shape, xfB);
  }
}
</pre>
</div>
<h3>Extends</h3>
<p>
<span class="type-box"><span class="icon-class"></span><a href="../box2d_console/Contact.html">Contact</a></span>&nbsp;&gt;&nbsp;<span class="type-box"><span class="icon-class"></span><strong>PolygonAndCircleContact</strong></span></p>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="PolygonAndCircleContact">
<button class="show-code">Code</button>
new <strong>PolygonAndCircleContact</strong>(<a href="../box2d_console/DefaultWorldPool.html">DefaultWorldPool</a> argPool) <a class="anchor-link" href="#PolygonAndCircleContact"
              title="Permalink to PolygonAndCircleContact.PolygonAndCircleContact">#</a></h4>
<div class="doc">
<pre class="source">
PolygonAndCircleContact(DefaultWorldPool argPool) :
  super(argPool) { }
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field inherited"><h4 id="edge1">
<button class="show-code">Code</button>
<a href="../box2d_console/ContactEdge.html">ContactEdge</a>         <strong>edge1</strong> <a class="anchor-link"
            href="#edge1"
            title="Permalink to PolygonAndCircleContact.edge1">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>Nodes for connecting bodies.</p>
<pre class="source">
ContactEdge edge1;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="edge2">
<button class="show-code">Code</button>
<a href="../box2d_console/ContactEdge.html">ContactEdge</a>         <strong>edge2</strong> <a class="anchor-link"
            href="#edge2"
            title="Permalink to PolygonAndCircleContact.edge2">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
ContactEdge edge2;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="enabled">
<button class="show-code">Code</button>
bool         <strong>enabled</strong> <a class="anchor-link"
            href="#enabled"
            title="Permalink to PolygonAndCircleContact.enabled">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>Enable/disable this contact. This can be used inside the pre-solve
contact listener. The contact is only disabled for the current time step
(or sub-step in continuous collisions).</p>
<pre class="source">
bool get enabled () {
  return (flags &amp; ENABLED_FLAG) == ENABLED_FLAG;
}
</pre>
<pre class="source">
void set enabled(bool flag) {
  if (flag) {
    flags |= ENABLED_FLAG;
  } else {
    flags &amp;= ~ENABLED_FLAG;
  }
}
</pre>
</div>
</div>
<div class="field inherited"><h4 id="fixtureA">
<button class="show-code">Code</button>
<a href="../box2d_console/Fixture.html">Fixture</a>         <strong>fixtureA</strong> <a class="anchor-link"
            href="#fixtureA"
            title="Permalink to PolygonAndCircleContact.fixtureA">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
Fixture fixtureA;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="fixtureB">
<button class="show-code">Code</button>
<a href="../box2d_console/Fixture.html">Fixture</a>         <strong>fixtureB</strong> <a class="anchor-link"
            href="#fixtureB"
            title="Permalink to PolygonAndCircleContact.fixtureB">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
Fixture fixtureB;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="flags">
<button class="show-code">Code</button>
int         <strong>flags</strong> <a class="anchor-link"
            href="#flags"
            title="Permalink to PolygonAndCircleContact.flags">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>The flags for this Contact.</p>
<pre class="source">
int flags;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="manifold">
<button class="show-code">Code</button>
<a href="../box2d_console/Manifold.html">Manifold</a>         <strong>manifold</strong> <a class="anchor-link"
            href="#manifold"
            title="Permalink to PolygonAndCircleContact.manifold">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
Manifold manifold;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="next">
<button class="show-code">Code</button>
<a href="../box2d_console/Contact.html">Contact</a>         <strong>next</strong> <a class="anchor-link"
            href="#next"
            title="Permalink to PolygonAndCircleContact.next">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
Contact next;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="pool">
<button class="show-code">Code</button>
<a href="../box2d_console/DefaultWorldPool.html">DefaultWorldPool</a>         <strong>pool</strong> <a class="anchor-link"
            href="#pool"
            title="Permalink to PolygonAndCircleContact.pool">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
DefaultWorldPool pool;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="prev">
<button class="show-code">Code</button>
<a href="../box2d_console/Contact.html">Contact</a>         <strong>prev</strong> <a class="anchor-link"
            href="#prev"
            title="Permalink to PolygonAndCircleContact.prev">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>World pool and list pointers.</p>
<pre class="source">
Contact prev;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="runtimeType">
<button class="show-code">Code</button>
final Type         <strong>runtimeType</strong> <a class="anchor-link"
            href="#runtimeType"
            title="Permalink to PolygonAndCircleContact.runtimeType">#</a>
        </h4>
        <div class="inherited-from">inherited from Object </div><div class="doc">
<p>A representation of the runtime type of the object.</p>
<pre class="source">
external Type get runtimeType;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="toiCount">
<button class="show-code">Code</button>
num         <strong>toiCount</strong> <a class="anchor-link"
            href="#toiCount"
            title="Permalink to PolygonAndCircleContact.toiCount">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
num toiCount;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="touching">
<button class="show-code">Code</button>
final bool         <strong>touching</strong> <a class="anchor-link"
            href="#touching"
            title="Permalink to PolygonAndCircleContact.touching">#</a>
        </h4>
        <div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>Is this contact touching</p>
<pre class="source">
bool get touching() {
  return (flags &amp; TOUCHING_FLAG) == TOUCHING_FLAG;
}
</pre>
</div>
</div>
</div>
<div>
<h3>Operators</h3>
<div class="method inherited"><h4 id="==">
<button class="show-code">Code</button>
bool <strong>operator ==</strong>(other) <a class="anchor-link" href="#=="
              title="Permalink to PolygonAndCircleContact.operator ==">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>The equality operator.</p>
<p>The default behavior for all <code>Object</code>s is to return true if and
only if <code>this</code> and 
<span class="param">other</span> are the same object.</p>
<p>If a subclass overrides the equality operator it should override
the <code>hashCode</code> method as well to maintain consistency.</p>
<pre class="source">
bool operator ==(other) =&gt; identical(this, other);
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method inherited"><h4 id="Contact">
<button class="show-code">Code</button>
new <strong>Contact</strong>(<a href="../box2d_console/DefaultWorldPool.html">DefaultWorldPool</a> pool) <a class="anchor-link" href="#Contact"
              title="Permalink to PolygonAndCircleContact.Contact">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
Contact(DefaultWorldPool pool) :
  manifold = new Manifold(),
  fixtureA = null,
  fixtureB = null,
  edge1 = new ContactEdge(),
  edge2 = new ContactEdge(),
  pool = pool,
  _oldManifold = new Manifold() { }
</pre>
</div>
</div>
<div class="method"><h4 id="evaluate">
<button class="show-code">Code</button>
void <strong>evaluate</strong>(<a href="../box2d_console/Manifold.html">Manifold</a> argManifold, <a href="../box2d_console/Transform.html">Transform</a> xfA, <a href="../box2d_console/Transform.html">Transform</a> xfB) <a class="anchor-link" href="#evaluate"
              title="Permalink to PolygonAndCircleContact.evaluate">#</a></h4>
<div class="doc">
<div class="inherited">
<p>Abstract method.</p>
<div class="docs-inherited-from">docs inherited from <a href="../box2d_console/Contact.html">Contact</a> </div></div>
<pre class="source">
void evaluate(Manifold argManifold, Transform xfA, Transform xfB) {
  pool.collision.collidePolygonAndCircle(argManifold, fixtureA.shape,
      xfA, fixtureB.shape, xfB);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="flagForFiltering">
<button class="show-code">Code</button>
void <strong>flagForFiltering</strong>() <a class="anchor-link" href="#flagForFiltering"
              title="Permalink to PolygonAndCircleContact.flagForFiltering">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>Flag this contact for filtering. Filtering will occur the next time step.</p>
<pre class="source">
void flagForFiltering() {
  flags |= FILTER_FLAG;
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="getWorldManifold">
<button class="show-code">Code</button>
void <strong>getWorldManifold</strong>(<a href="../box2d_console/WorldManifold.html">WorldManifold</a> worldManifold) <a class="anchor-link" href="#getWorldManifold"
              title="Permalink to PolygonAndCircleContact.getWorldManifold">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<p>Intializes the given world manifold.</p>
<pre class="source">
void getWorldManifold(WorldManifold worldManifold) {
  final Body bodyA = fixtureA.body;
  final Body bodyB = fixtureB.body;
  final Shape shapeA = fixtureA.shape;
  final Shape shapeB = fixtureB.shape;

  worldManifold.initialize(manifold, bodyA.originTransform,
      shapeA.radius, bodyB.originTransform, shapeB.radius);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="hashCode">
<button class="show-code">Code</button>
int <strong>hashCode</strong>() <a class="anchor-link" href="#hashCode"
              title="Permalink to PolygonAndCircleContact.hashCode">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Get a hash code for this object.</p>
<p>All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator <code>==</code>. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.</p>
<p>If a subclass overrides <code>hashCode</code> it should override the
equality operator as well to maintain consistency.</p>
<pre class="source">
external int hashCode();
</pre>
</div>
</div>
<div class="method"><h4 id="init">
<button class="show-code">Code</button>
void <strong>init</strong>(<a href="../box2d_console/Fixture.html">Fixture</a> fA, <a href="../box2d_console/Fixture.html">Fixture</a> fB) <a class="anchor-link" href="#init"
              title="Permalink to PolygonAndCircleContact.init">#</a></h4>
<div class="doc">
<div class="inherited">
<p>Initialization for pooling.</p>
<div class="docs-inherited-from">docs inherited from <a href="../box2d_console/Contact.html">Contact</a> </div></div>
<pre class="source">
void init(Fixture fA, Fixture fB) {
  Expect.equals(ShapeType.POLYGON, fA.type);
  Expect.equals(ShapeType.CIRCLE, fB.type);
  super.init(fA, fB);
}
</pre>
</div>
</div>
<div class="method inherited"><h4 id="noSuchMethod">
<button class="show-code">Code</button>
<strong>noSuchMethod</strong>(String name, List args) <a class="anchor-link" href="#noSuchMethod"
              title="Permalink to PolygonAndCircleContact.noSuchMethod">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p><code>noSuchMethod</code> is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to <code>noSuchMethod</code>. If <code>noSuchMethod</code>
returns a value, that value becomes the result of the original
invocation.</p>
<p>The default behavior of <code>noSuchMethod</code> is to throw a
<code>noSuchMethodError</code>.</p>
<pre class="source">
external Dynamic noSuchMethod(String name, List args);
</pre>
</div>
</div>
<div class="method inherited"><h4 id="Object">
<button class="show-code">Code</button>
const <strong>Object</strong>() <a class="anchor-link" href="#Object"
              title="Permalink to PolygonAndCircleContact.Object">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Creates a new <code>Object</code> instance.</p>
<p><code>Object</code> instances have no meaningful state, and are only useful
through their identity. An <code>Object</code> instance is equal to itself
only.</p>
<pre class="source">
const Object();
</pre>
</div>
</div>
<div class="method"><h4 id="PolygonAndCircleContact">
<button class="show-code">Code</button>
new <strong>PolygonAndCircleContact</strong>(<a href="../box2d_console/DefaultWorldPool.html">DefaultWorldPool</a> argPool) <a class="anchor-link" href="#PolygonAndCircleContact"
              title="Permalink to PolygonAndCircleContact.PolygonAndCircleContact">#</a></h4>
<div class="doc">
<pre class="source">
PolygonAndCircleContact(DefaultWorldPool argPool) :
  super(argPool) { }
</pre>
</div>
</div>
<div class="method inherited"><h4 id="toString">
<button class="show-code">Code</button>
String <strong>toString</strong>() <a class="anchor-link" href="#toString"
              title="Permalink to PolygonAndCircleContact.toString">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Returns a string representation of this object.</p>
<pre class="source">
external String toString();
</pre>
</div>
</div>
<div class="method inherited"><h4 id="update">
<button class="show-code">Code</button>
void <strong>update</strong>(<a href="../box2d_console/ContactListener.html">ContactListener</a> listener) <a class="anchor-link" href="#update"
              title="Permalink to PolygonAndCircleContact.update">#</a></h4>
<div class="inherited-from">inherited from <a href="../box2d_console/Contact.html">Contact</a> </div><div class="doc">
<pre class="source">
void update(ContactListener listener) {
  _oldManifold.setFrom(manifold);

  // Re-enable this contact.
  flags |= ENABLED_FLAG;

  bool touching = false;
  bool wasTouching = (flags &amp; TOUCHING_FLAG) == TOUCHING_FLAG;

  bool sensorA = fixtureA.isSensor;
  bool sensorB = fixtureB.isSensor;
  bool sensor = sensorA || sensorB;

  Body bodyA = fixtureA.body;
  Body bodyB = fixtureB.body;
  Transform xfA = bodyA.originTransform;
  Transform xfB = bodyB.originTransform;

  if (sensor) {
    Shape shapeA = fixtureA.shape;
    Shape shapeB = fixtureB.shape;
    touching = pool.collision.testOverlap(shapeA, shapeB, xfA, xfB);

    // Sensors don't generate manifolds.
    manifold.pointCount = 0;
  } else {
    evaluate(manifold, xfA, xfB);
    touching = manifold.pointCount &gt; 0;

    // Match old contact ids to new contact ids and copy the
    // stored impulses to warm start the solver.
    for (int i = 0; i &lt; manifold.pointCount; ++i) {
      ManifoldPoint mp2 = manifold.points[i];
      mp2.normalImpulse = 0.0;
      mp2.tangentImpulse = 0.0;
      ContactID id2 = mp2.id;

      for (int j = 0; j &lt; _oldManifold.pointCount; ++j) {
        ManifoldPoint mp1 = _oldManifold.points[j];

        if (mp1.id.isEqual(id2)) {
          mp2.normalImpulse = mp1.normalImpulse;
          mp2.tangentImpulse = mp1.tangentImpulse;
          break;
        }
      }
    }

    if (touching != wasTouching) {
      bodyA.awake = true;
      bodyB.awake = true;
    }
  }

  if (touching) {
    flags |= TOUCHING_FLAG;
  } else {
    flags &amp;= ~TOUCHING_FLAG;
  }

  if (listener == null) {
    return;
  }

  if (wasTouching == false &amp;&amp; touching == true) {
    listener.beginContact(this);
  }

  if (wasTouching == true &amp;&amp; touching == false) {
    listener.endContact(this);
  }

  if (sensor == false &amp;&amp; touching) {
    listener.preSolve(this, _oldManifold);
  }
}
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
